package com.forenow.demo.Book;

import java.util.Scanner;

public class Rectangle {
    public Double getArea(Double l,Double w){
        Double area=l*w;
        return area;
    }
    public Double getPer(Double length, Double width){
        Double Per= 2*(length+width);
        return Per;
    }
    public void showAll(){
        RecObject recObject=new RecObject();
        Double length=recObject.getLength();
        Double width=recObject.getWidth();
        Double area=length*width;
        Double Per=2*(length+width);
        System.out.println("长：/t"+length+"宽：/t"+width+"面积：/t"+area+"周长+/t"+Per);
    }

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        Rectangle rectangle=new Rectangle();
        System.out.print("输入长:");
        Double l=scanner.nextDouble();
        System.out.print("输入宽:");
        Double w=scanner.nextDouble();
        RecObject recObject=new RecObject(l,w);
        Double length=recObject.getLength();
        Double width=recObject.getWidth();
        Double Area=rectangle.getArea(length,width);
        System.out.print("面积："+Area);
        Double Per=rectangle.getPer(length,width);
        System.out.print("周长："+Per);
    }

}
